import type {
  DataReslut,
  DocDetail,
  TopicDetail,
  TopicItem,
} from '@/types/healthEncyclopedia';
import type { Collect, patient } from '@/types/home';
import type { FamilyData } from '@/types/types';
import { http } from '@/utils/request';
// 获取图片
export const getHomeKnowledgeTopicAPI = () =>
  http<TopicItem[]>('/knowledge/topic', 'GET');
// 获取推荐|关注列表
export const getHomeKnowledgeListAPI = (
  current: number,
  pageSize: number,
  keyword: 'recommend' | 'follow'
) => http<patient>('/knowledge/list', 'GET', { current, pageSize, keyword });
// 话题数据
export const getKnowledgeTopicByIdAPI = (id: string) =>
  http<TopicDetail>(`/knowledge/topic/${id}`, 'GET');
// 话题列表
export const getknowledgeListAPI = (
  current: number,
  pageSize: number,
  topicId: string
) => http<patient>('/knowledge/list', 'GET', { current, pageSize, topicId });
// 收藏
export const postCollectAPI = (type: string, id: string) =>
  http<Collect>('/collect', 'POST', { type, id });
// 家庭档案
export const getPatientMylistAPI = () =>
  http<FamilyData[]>('/patient/mylist', 'GET');

// 添加患者
export const postPatientAddAPI = (
  name: string,
  idCard: string,
  defaultFlag: number,
  gender: number
) => http('/patient/add', 'POST', { name, idCard, defaultFlag, gender });
// 编辑患者
export const putPatientUpdateAPI = (
  name: string,
  idCard: string,
  defaultFlag: number,
  gender: number,
  id: string
) => http('/patient/update', 'PUT', { name, idCard, defaultFlag, gender, id });
export const deletePatientDelByIdAPI = (id: string) =>
  http(`/patient/del/${id}`, 'DELETE');
